#ifndef _HANDLEMANAGER_H_
#define _HANDLEMANAGER_H_

#include <utillib/util/singleton.h>

#define		APP_EXIT		-1

#define POSTMESSAGE( __msgID__, __wparam__ , __lparam__ )	\
		interfacelib::Frame::HandleManager::getInstance()->postMessage( __msgID__, __wparam__, __lparam__ )

namespace interfacelib
{
	namespace Frame
	{
		class HandleManager
		{
		protected:
			HandleManager();
		public:
			virtual ~HandleManager();

			SingletonInstance( HandleManager );

			void initialize( HINSTANCE windowInstance, HWND windowHandle );
			HWND getWindowHandle();
			HINSTANCE getWindowInstance();

			bool postMessage( unsigned int msgID, WPARAM wparam, LPARAM lparam );

			void setPreRelease(  void ( *setFunctionPreRelease )() );
			void preRelease();

		private:
			void ( *functionPreRelease )();
			HWND m_windowHandle;
			HINSTANCE m_windowInstance;
		};
	};
};

#endif